﻿@using System.Globalization
@using BookShop.Library.Constant
@using BookShop.Library.Common
@model BookShop.DTO.Book
@{
    ViewBag.Title = Model.Id + " - Chi tiết Sách";
}

<div class="portlet box blue">
    <div class="portlet-title">
        <div class="caption">
            <i class="fa fa-book"></i>@ViewBag.Title
        </div>
    </div>
    <div class="portlet-body form detail-form" id="author_detail">
        <form class="form-horizontal" method="GET" action="@Url.Action("Detail")">
            <input type="hidden" name="bookId" value="@Model.Id"/>
            <div class="form-body">
                <div class="row">
                    <div class="col-md-6">
                        <div class="form-group">
                            <label class="control-label col-md-4">Tiêu đề:</label>
                            <div class="col-md-8">
                                <p class="form-control-static">@Model.Title</p>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="form-group">
                            <label class="control-label col-md-4">Tác giả:</label>
                            <div class="col-md-8">
                                <p class="form-control-static">@Model.AuthorName</p>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-md-6">
                        <div class="form-group">
                            <label class="control-label col-md-4">Thể loại:</label>
                            <div class="col-md-8">
                                <p class="form-control-static">@Model.CategoryName</p>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="form-group">
                            <label class="control-label col-md-4">Nhà xuất bản:</label>
                            <div class="col-md-8">
                                <p class="form-control-static">@Model.PublisherName</p>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-md-6">
                        <div class="form-group">
                            <label class="control-label col-md-4">Giá (VNĐ):</label>
                            <div class="col-md-8">
                                <p class="form-control-static">@Model.Price</p>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="form-group">
                            <label class="control-label col-md-4">Số lượng:</label>
                            <div class="col-md-8">
                                <p class="form-control-static">@Model.Quantity</p>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-md-6">
                        <div class="form-group">
                            <label class="control-label col-md-4">Ngày xuất bản:</label>
                            <div class="col-md-8">
                                <p class="form-control-static">@(Model.PublishDate.HasValue ? Model.PublishDate.Value.ToString("d", CultureInfo.CreateSpecificCulture("vi-VN")) : string.Empty)</p>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="form-group">
                            <label class="control-label col-md-4">Số trang:</label>
                            <div class="col-md-8">
                                <p class="form-control-static">@Model.PageNumber</p>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-md-6">
                        <div class="form-group">
                            <label class="control-label col-md-4">Kích thước:</label>
                            <div class="col-md-8">
                                <p class="form-control-static">@Model.Size</p>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="form-group">
                            <label class="control-label col-md-4">Trạng thái:</label>
                            <div class="col-md-8">
                                <p class="form-control-static">
                                    @if (Model.Status == BookStatus.Active)
                                    {
                                        @("Active")
                                    }
                                    else if (Model.Status == BookStatus.Inactive)
                                    {
                                        @("Inactive")
                                    }
                                </p>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-md-6">
                        <div class="form-group">
                            <label class="control-label col-md-4">Mô tả:</label>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="form-group">
                        <label class="control-label col-md-2"></label>
                        <div class="col-md-8">
                            <p class="form-control-static">@Html.Raw(Model.Description)</p>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-md-6">
                        <div class="form-group">
                            <label class="control-label col-md-4">Ảnh:</label>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="form-group">
                        <label class="control-label col-md-2"></label>
                        <div class="col-md-8">
                            <img src="@HTN.Library.Utility.UrlCombine(CommonFunction.GetConfigValue("SiteUrl"), Model.PictureUrl)" alt/>
                        </div>
                    </div>
                </div>
            </div>
            <div class="form-actions right">
                <a href="@Url.Action("List")" class="btn default">Quay lại</a>
            </div>
        </form>
    </div>
</div>

@section css
{
    <link type="text/css" rel="stylesheet" href="@Url.Content("~/Content/assets/global/plugins/bootstrap-toastr/toastr.min.css")"/>
}

@section javascript 
{
    <script type="text/javascript" src="@Url.Content("~/Content/assets/global/plugins/bootstrap-toastr/toastr.min.js")"></script>
    @if (TempData[AlertMessage.TempDataKey] != null)
    {
        <script type="text/javascript">
            toastr['error']('@TempData[AlertMessage.TempDataKey].ToString()', 'Error');
            toastr.option = {
                "closeButton": true,
                "debug": false,
                "positionClass": "toast-top-right",
                "onclick": null,
                "showDuration": "1000",
                "hideDuration": "1000",
                "timeOut": "5000",
                "extendedTimeOut": "1000",
                "showEasing": "swing",
                "hideEasing": "linear",
                "showMethod": "fadeIn",
                "hideMethod": "fadeOut"
            }
        </script>
    }
}